﻿Namespace Darkorbit
    Public Class Encryption
        Shared Function CryptCaesar(ByVal sText As String) As String
            Dim zahlenreihe As String = ""
            Dim alphabet As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!""§$%&/()=²³@€,;.:-_#'+*~´`{[]}<>|\"

            For i = 0 To sText.Length - 1
                If alphabet.Contains(sText.Chars(i)) Then
                    Dim pos As Integer = alphabet.IndexOf(sText.Chars(i)) + 5
                    If zahlenreihe = "" Then
                        zahlenreihe = alphabet.Chars(pos)
                    Else
                        zahlenreihe = zahlenreihe + alphabet.Chars(pos)
                    End If
                End If
            Next

            Return zahlenreihe

        End Function

        Shared Function DeCryptCaesar(ByVal sText As String) As String

            Dim zahlenreihe As String = ""
            Dim alphabet As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!""§$%&/()=²³@€,;.:-_#'+*~´`{[]}<>|\"

            For i = 0 To sText.Length - 1
                If alphabet.Contains(sText.Chars(i)) Then
                    Dim pos As Integer = alphabet.IndexOf(sText.Chars(i)) - 5
                    If zahlenreihe = "" Then
                        zahlenreihe = alphabet.Chars(pos)
                    Else
                        zahlenreihe = zahlenreihe + alphabet.Chars(pos)
                    End If
                End If
            Next

            Return zahlenreihe

        End Function
    End Class
End Namespace
